package sk.fiit.icp.contact.view;

import org.apache.wicket.extensions.yui.calendar.DateField;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.RequiredTextField;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.validation.validator.StringValidator;

import sk.fiit.icp.data.Users;
import sk.fiit.icp.data.UsersDao;

public class ContactForm extends Form<Users> {
	@SpringBean(name = "usersDao")
	public UsersDao usersDao;

	public ContactForm(String id, IModel<Users> model) {
		super( id, model );
		setOutputMarkupId( true );
		final FeedbackPanel feedbackPanel = new FeedbackPanel( "feedback" );
		feedbackPanel.setOutputMarkupId( true );
		add( feedbackPanel );
		add( new RequiredTextField<String>( "lname" ).add( StringValidator.maximumLength( 20 ) ) );
		add( new RequiredTextField<String>( "email" ).add( StringValidator.maximumLength( 20 ) ) );
		add( new DateField( "birthdate" ) );
		add( new TextField<String>( "address" ) );
		add( new TextField<String>( "city" ) );
		add( new TextField<String>( "state" ) );
		add( new TextField<String>( "phone" ) );

	}

}
